using System.Data;
using ET;
namespace DAL
{
    public class Districts_DAL
    {
        private static readonly clsConnect cls = new clsConnect();

        #region Getdata

        public DataTable BindGirdDistricts(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Districts_Search");
        }

        public DataTable BindGirdDistrictsDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Districts_ID", id);
            return cls.GetData("sp_tb_Districts_Detail");
        }

        public DataTable BindGirdDistricts_Province(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_Id", id);
            return cls.GetData("sp_tb_Districts_Province");
        }

        public static DataTable GetDistrictsFillter(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_Id", id);
            return cls.GetData("sp_tb_Districts_Fillter");
        }

        public static DataTable GetDistrictsDetail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Districts_ID", id);
            return cls.GetData("sp_tb_Districts_DetailEmployee");
        }
        #endregion

        #region Insert

        public bool InsertDistricts(Districts_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Province_Id", data.Province_Id);
            cls.AddParameter("@Districts_Alias", data.Districts_Alias);
            cls.AddParameter("@Districts_Name", data.Districts_Name);
            cls.AddParameter("@Districts_Note", data.Districts_Note);
            return cls.ExecuteNonQuery("sp_tb_Districts_Insert");
        }

        #endregion

        #region Update

        public bool UpdateDistricts(Districts_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Districts_Id", data.Districts_Id);
            cls.AddParameter("@Province_Id", data.Province_Id);
            cls.AddParameter("@Districts_Alias", data.Districts_Alias);
            cls.AddParameter("@Districts_Name", data.Districts_Name);
            cls.AddParameter("@Districts_Note", data.Districts_Note);
            return cls.ExecuteNonQuery("sp_tb_Districts_Update");
        }

        #endregion

        #region Delete

        public bool DeleteDistricts(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Districts_Id", id);
            return cls.ExecuteNonQuery("sp_tb_Districts_Delete");
        }

        #endregion
    }
}